/**
 * 全局注册组件
 */
const files = require.context('./', true, /index.vue/)

const components = files.keys().reduce((components: any, path: string) => {
    const component = files(path).default
    const name = component.name
    components[name] = component
    return components
}, {})

export default (app, params) => {
    Object.keys(components).forEach((name) => {
        app.component(name, components[name])
    })
}
